package com.slh.touchandroid.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import com.slh.touchandroid.R;
import com.slh.touchandroid.activity.ChangeIconActivity;
import com.slh.touchandroid.activity.SettingsActivity;
import com.slh.touchandroid.activity.SettingsPanelActivity;

public class TouchFragment extends BaseFragment implements OnClickListener {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		setRetainInstance(true);
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_touch, container,
				false);
		rootView.findViewWithTag(getString(R.string.tag_settings))
				.setOnClickListener(this);
		rootView.findViewWithTag(getString(R.string.tag_changeicon))
				.setOnClickListener(this);
		rootView.findViewWithTag(getString(R.string.tag_panel))
				.setOnClickListener(this);
		return rootView;
	}

	@Override
	public void onClick(View v) {
		String tag = (String) v.getTag();
		if (getString(R.string.tag_settings).equals(tag)) {
			SettingsActivity.start(getActivity());
		} else if (getString(R.string.tag_panel).equals(tag)) {
			SettingsPanelActivity.start(getActivity());
		} else if (getString(R.string.tag_changeicon).equals(tag)) {
			ChangeIconActivity.start(getActivity());
		}
	}

	// ==========================================================================

}
